Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Originally derived from node-ext package.
$ npm install fs2
Same as fs.chmod. Returns promise.
Not available on Windows.
Copy file, returns promise but accepts as well regular callback. Eventual options are passed to underlying fs.createWriteStream
Copy directory recursively, returns promise but accepts as well regular callback.
Supported options:
Initializes EMFILE errors prevention.
To be used only in main modules. Never require it in generic module that may be required in others
How it works? If limit of descriptors is reached it holds the calls to native functions and releases them when taken descriptors are freed.
Internally it provides same solution as fs-graceful module with following differences:
Whether path points to a directory
Resolves with true
if provided path points to a directory, false
if provided path points to a non-directory file, null
if there's no file at path. Returns promise.
Whether file is ignored up to predefined rules. Returns promise but regular callback is also supported.
Rules are decided by mode argument. Currently only git
mode is supported, in that case rules are searched in .gitignore files (Rules have effect only if placed in valid git repositories).
Other modes can be easily configured by extending _ignoreModes
module (See lib/fs/_ignore-modes directory to see how it's done).
Supported options:
string|array
- additional global rules. They will be matched as if placed in filesystem root directory, it means that any rules found in existing ignore files may override them.bool
- whether to watch for changes. If ignore state would change, returned promise would emit change
event with new value (true/false)Whether path points to a symlimk
Resolves with true
if provided path points to symlink, false
if provided path points to a non-symlink file, null
if there's no file at path. Returns promise.
Additionally resultion can be fine tuned for specific needs with below options:
Supported options:
string
- Expected linkPath to which symlink should point. If provided and symlink points elsewhere false
is returned.bool
- whether check for matching linkPath
should be applied to final path (so if symlink points to other symlink we check against the final path, and not linked symlink path)Same as fs.lchmod. Returns promise.
Only available on Mac OS X.
Same as fs.lstat. Returns promise.
Extended version of native mkdir. Returns promise
Supported options:
mkir -p
, internal implementation inspired by Substack's node-mkdirpExtended version of native fs.readFile. Returns promise
Supported options:
Extended version of native fs.readdir. Returns promise
Suported options:
number
- Level of recurse into subdirectories. Defaults to 0 which resembles behavior of native version. If you want to recurse without any nest limitation just provide Infinityobject
- Which type of files should be returned. By default all files are returned. Stats methods shows how many different types can be returned. To narrow it down provide a hash. e.g. { file: true, symbolicLink: true }
.regexp
- Filter returned files by specific pattern. Pattern should be regular expression that would be matched against full path.bool
- Watch directory for changes. Changes are emitted on returned promise with data
events. event object states which files were added (event.added
) and which were removed (event.removed
), Starting from next release (v0.4) this functionality will most likely be provided as valid Node.js streambool
- Whether to provide data continuously. Currently it's not provided as a stream per se (it would be starting from next release, v0.4), data is emited as data
events on returned promise object, structure of event objects described under watch optionstring|array
- Whether to obey ignore rules found in ignore files. See fs.isIgnored for more informationstring|array
- Global rules that complement ignoreRules. See fs.isIgnored for more information.Same as fs.readlink. Returns promise.
Supports loose: true
option, which when passed, resolves with null
(instead of exception) if file at path is not a symlink or it doesn't exist.
Same as fs.realpath. Returns promise.
Supports loose: true
option, which when passed, resolves with null
(instead of exception) if path doesn't exist
Same as fs.rename. Returns promise.
Extended version of native rmdir. Returns promise
Supported options:
Same as fs.stat. Returns promise.
Same as fs.symlink. Returns promise.
Returns type of file according to provided stats object.
Same as fs.unlink. Returns promise.
Watch specific path for changes. It's about observing specific file path (not directory content). change
events are emitted with event object where event.type
says wether file was created, modified or removed.
Watch file for changes.
fs.watch wrapper that works same way on every platform, always configured in persistent: false mode.
It's aware of open file descriptors limitations, if EMFILE error is approach, switch to alternative mode that pings file stats (see fs.watchFile) is made.
Same as native fs.writeFile but safe for simultaneous calls of write to same file (in such case current write will be abandonded, and new would be started).
Supported options:
$ npm test
FAQs
fs (file system package) extensions
The npm package fs2 receives a total of 720,955 weekly downloads. As such, fs2 popularity was classified as popular.
We found that fs2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.